from threading import Thread, Event
from time import sleep

# 全局变量用于通信
s = None
e = Event()


def 杨子荣():
    print('杨子荣前来拜山头')
    global s
    s = '天王盖地虎'
    # 共享资源操作完毕
    e.set()


if __name__ == "__main__":
    t = Thread(target=杨子荣)
    t.start()
    print('说对口令就是自己人')
    # 阻塞等待
    e.wait()
    if s == '天王盖地虎':
        print('宝塔镇河妖')
        print('确认过眼神，你是对的人')
    else:
        print('打死他....')
    t.join()
